package com.common.frame.widget


import android.app.Dialog
import android.content.Context
import android.view.Gravity
import android.view.WindowManager
import android.widget.TextView
import com.common.frame.R

class LoadingDialog(context: Context) : Dialog(context, R.style.dialog_style) {

    var tvTips: TextView? = null

    init {

        setContentView(R.layout.dialog_loading)
        tvTips = findViewById(R.id.tv_tips)
        setCanceledOnTouchOutside(false)
        window?.let {
            it.setGravity(Gravity.CENTER) //设置dialog的显示位置
            it.attributes.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND //弹窗获取焦点
            it.attributes.dimAmount = 0f
        }
    }

    fun setTips(text: String) {
        tvTips?.text = text
    }
}